/**
 * Created by AllanXu on 7/25/2016.
 */
define(function (require) {
	var Vue = require('vue'),
		Config = require('config'),
		_ = require('ajax'),
		utilities = require('utilities'),
		userId = sessionStorage.id;
	// 认证
	var AuthDialog = require('auth_dialog');
	var authDialog = new AuthDialog();
	// 禁用申诉
	var Forbidden = require('forbidden');
	var forbidden = new Forbidden();
    var id = utilities.getParameterByName('id'), page = utilities.getParameterByName('id');
	var app = new Vue({
		el: '#friendvideo',
		data: {
			// pageIndex: 1,
			videoWidth: 0,
			pageCount: '',
			pageno: 1,
			renderObj: {
				listArr: []
			},
			tabsName: [],
			typeId: '',
            id:id,
			curNum: -1,
			bottomTxt: '',
			picServer: Config.picServer
		},
		methods: {
			init: function () {
                this.videoWidth = (document.body.clientWidth - 30) / 2;
				_(Config.SERVICE.USERCENTER.MYALBUMLIST + '?id=' + app.id + '&pageno=' + app.pageno + '&pagesize=10&type=1', {}, function (data) {
					// _(Config.SERVICE.ACTIVITY.LIST+'?id='+4+'&param='+utilities.jsonObjToBase64(param), {}, function(data) {
					if (app.pageno == 1) {
						app.renderObj.listArr = data.pageitems;
						app.pageCount = data.pagecount;
					} else {
						app.renderObj.listArr = app.renderObj.listArr.concat(data.pageitems);
					}
				});
			}
		}
	});
	app.init();

	window.onscroll = function () {
		var scrolltop = document.body.scrollTop | document.documentElement.scrollTop;
		var clientHeight = document.documentElement.clientHeight;
		if (scrolltop + clientHeight == document.body.clientHeight) {
			if (app.pageno <= app.pageCount) {
				app.pageno++;
				app.init();
			} else {
				app.bottomTxt = '到底儿了~';
			}
		}
	};

});